# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Guy Godfroy <guy.godfroy@gugod.fr>
pkgname=sanlock
pkgver=3.9.5
pkgrel=0
pkgdesc="lease manager that uses shared storage"
url="https://pagure.io/sanlock"
arch="all"
license="LGPL-2.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later"
install="sanlock.pre-install"
makedepends="
	linux-headers
	libaio-dev
	util-linux-dev
	python3
	python3-dev
	py3-setuptools
	"
checkdepends="py3-pytest"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc py3-sanlock:py3"
source="
	https://pagure.io/sanlock/archive/sanlock-$pkgver/sanlock-sanlock-$pkgver.tar.gz
	c23.patch
	basename-include.patch
	sanlock.initd
	sanlock.confd
	wdmd.initd
	wdmd.confd
	"
options="!check" # all tests are failing
builddir="$srcdir/sanlock-sanlock-$pkgver"

build() {
	make
}

package() {
	make DESTDIR="$pkgdir" LIBDIR="/usr/lib" install
	install -Dm644 "$srcdir"/sanlock.confd \
		"$pkgdir"/etc/conf.d/sanlock
	install -Dm755 "$srcdir"/sanlock.initd \
		"$pkgdir"/etc/init.d/sanlock
	install -Dm644 "$srcdir"/wdmd.confd \
		"$pkgdir"/etc/conf.d/wdmd
	install -Dm755 "$srcdir"/wdmd.initd \
		"$pkgdir"/etc/init.d/wdmd
}

py3() {
	amove usr/lib/python3*
}

sha512sums="
9db09a1182eba57e032c11c86d8b19af08202c26ed581a5dae32d3e5c459c242ce5e837c4c71c41094b38fffdf5aae12514f5992cf17a19d9f6974bdaf4a3bc9  sanlock-sanlock-3.9.5.tar.gz
be8b51e1ca7cb66ff9f9f02977770c0b72115658985c3d272aab10bc98428f3851b1654b0c74d5b0ac1b935ddaf71af67c3919ca32d5c133ac7208890301833b  c23.patch
b95420bd114249b0680c6624f96c851a063038a84af85f2d31af949dc934753c2fccfda37af2274743cbf05b3bd5490a04d2d4e0472ecf232dc1726fb85f40e1  basename-include.patch
51f0c88bb0aff1670dc01fec8c025cc347bca88d4e5e5555e31486d6d5de560c12e6404eaeac651c35037022555e79e6c6a2bb897d0f2c0e6a38ff884cbd9743  sanlock.initd
0e8924efc6048e712497a8cdc8f272ae222017cb623583dd8308c7c4120242aecf08f2521b0ec6615952b6eca461762ac5a65b789295678311d02c5f7af2aaac  sanlock.confd
b447f28a3b7b14aafb3795ee97579644b299d8684945a663c18c9f0845ac35593ca6f337af74310ecfd3eb59c1ec8c1758c94055010d978579756cb1b49e5b3b  wdmd.initd
75191a957052f14f8ebb0cf9f89c93c03b1920be984d83f48cd812717a057bfe2682ccd8b7f5318cbe0b110ac04ca3cfde5a723540ac0b7b7c91a3e6415b7a6f  wdmd.confd
"
